import myAxios from "@/request";
import type {
  BuildingQueryRequest,
  BuildingAddRequest,
  BuildingUpdateRequest,
} from "@/models/building";

/**
 * 分页获取楼栋列表
 */
export function listBuildingByPage(buildingQueryRequest: BuildingQueryRequest) {
  return myAxios.request({
    url: "/api/building/list/page",
    method: "post",
    data: buildingQueryRequest,
  });
}

/**
 * 添加楼栋
 */
export function addBuilding(buildingAddRequest: BuildingAddRequest) {
  return myAxios.request({
    url: "/api/building/add",
    method: "post",
    data: buildingAddRequest,
  });
}

/**
 * 更新楼栋
 */
export function updateBuilding(buildingUpdateRequest: BuildingUpdateRequest) {
  return myAxios.request({
    url: "/api/building/update",
    method: "post",
    data: buildingUpdateRequest,
  });
}

/**
 * 删除楼栋
 */
export function deleteBuilding(id: number) {
  return myAxios.request({
    url: "/api/building/delete",
    method: "post",
    data: { id },
  });
}
